﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using _MetalSlug.Mission;
using Microsoft.Xna.Framework;

namespace _MetalSlug.Mementoes
{
    public class MapMemento: IMemento
    {
        Vector2 topLeft;
        public Vector2 TopLeft
        {
            get { return topLeft; }
        }

        public MapMemento(MyMap RepresentMap)
        {
            topLeft = RepresentMap.TopLeft;
        }

        public MapMemento(XmlElement Element)
        {
            float X, Y;
            X = float.Parse(Element.GetAttribute("X"));
            Y = float.Parse(Element.GetAttribute("Y"));
            topLeft = new Vector2(X,Y);
        }

        public XmlElement ToXML(XmlDocument Doc)
        {
            XmlElement Element = Doc.CreateElement("Map");
            Element.SetAttribute("X", TopLeft.X.ToString());
            Element.SetAttribute("Y", TopLeft.Y.ToString());
            return Element;
        }
    }
}
